/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sporejava;

/**
 *
 * @author tommystaying
 */
public class Omnivore extends Animal {

    public Omnivore(String nomEspece, String nom, String baseAdn, int identifiant, String ADN,int[] position) {
        super(nomEspece,  nom, baseAdn, identifiant, ADN, position);
    }

    @Override
    public void manger(EtreVivant e) {
         if((e instanceof Vegetal || e instanceof Animal) && !this.getNomEspece().equals(e.getNomEspece())){
            e.setSante(0);
            this.setNivFaim(100);
        }
    }

    @Override
    public EtreVivant reproduction(EtreVivant e) {
         if(!((Animal)e).getSexe().equals(this.getSexe()) && e.getNomEspece().equals(this.getNomEspece()) ){
            
        
        EtreVivant fils = new Omnivore(this.getNomAnimal(),"",this.getBaseADN(),this.getIdentifiant(), this.getADN(), this.getPosition());
        return fils;
        }
        return null;
    }

    
}
